package py.com.alfa.escriba.web.rest.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;

import py.com.alfa.escriba.config.EscribaApplicationContextProvider;
import py.com.alfa.escriba.exception.ServiceException;
import py.com.alfa.escriba.persistence.dto.admin.PersonaDTO;
import py.com.alfa.escriba.web.rest.EscribaService;
import py.com.alfa.escriba.web.rest.secure.PersonaSecureRESTService;
import py.com.alfa.escriba.web.services.PersonasService;

public class PersonasSecureRESTServiceImpl implements PersonaSecureRESTService{
	
	private Logger log = LoggerFactory.getLogger(getClass());
	private ApplicationContext ctx;
	private PersonasService personasService;
	
	public PersonasSecureRESTServiceImpl() {
		this.ctx = EscribaApplicationContextProvider.getContext();
		this.personasService = (PersonasService)this.ctx.getBean(EscribaService.PERSONAS_SERVICE);	
	}

	@Override
	public PersonaDTO obtenerPersona(Long id) throws ServiceException {		
		PersonaDTO dto = this.personasService.obtenerPersona(id);		
		return dto;
		
	}

	@Override
	public PersonaDTO crearPersona(PersonaDTO dto) throws ServiceException {
		PersonaDTO res = this.personasService.crearPersona(dto);		
		return res;
	}

}
